/**
 * Created by 华仔 on 2017/6/13.
 */
$(function () {
    // 模糊查询
    $('#seach-button').change(function () {
        var Id = 2;
        var tit=$(this).val();
        var data = {
            "id": 2,
            "tit": tit
        };


        $.ajax({
            type: "post",
            url: '/api/v1/feedService/feed/seacher',
            data:data,
            success: function (data) {
                $(".seacher-content").html(" ");
                for(var i=0;i<data.data.length;i++){
                      console.log(data.data[i].tagid)
                      console.log(data.data[i])
                    $(".seacher-content").append( '<li><p class="show_cont">'+data.data[i].content+'</p>'+
                        '<input hidden="hidden" value='+data.data[i].feedTag.id+' class="tagId"> <input hidden="hidden" value='+data.data[i].id+' class="feedId"></li>');
                }
            },
            error: function (msg) {
                alert('请求失败');
                console.log(msg)
            }
        });
    });
    $(".seacher-content").on("click",".show_cont",function () {
        var obj = $(this)
        console.log(obj);
        var tagId = obj.siblings(".tagId").val()
        var feedId = obj.siblings(".feedId").val()
        var userId=localStorage.getItem("userId");
        window.location.href="/h5/feed/feedDetail?userId="+userId+"&id="+feedId+"&tagid="+tagId
    })
});